<!DOCTYPE html>
<html lang="en">
<style>
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
    input[type=checkbox], input[type=radio] {
        display: inline-block;
    }
</style>
<link href="/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
{include file="Public/head"}

<body data-type="widgets">
<!--<script src="/daterangepicker/jquery-3.2.1.min.js" type="text/javascript"></script>-->
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper" >
        <div class="row-content am-cf">
            <div class="row">

                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">增加分类</div>
                            <div class="widget-function am-fr">
                                <a href="javascript:;" class="am-icon-cog"></a>
                            </div>
                        </div>
                        <div class="widget-body am-fr">
                            <form id="roleform"  form="submit" class="am-form tpl-form-border-form tpl-form-border-br">
                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">分类名称 </label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="cat_name" id="cat_name" placeholder="名称">
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">导航显示 </label>
                                    <div class="am-u-sm-9">
                                        <label> <input type="radio" class="tpl-form-input" value="0" name="show_in_nav" checked="checked">不显示</label>
                                        <label> <input type="radio" class="tpl-form-input" value="1" name="show_in_nav">显示</label>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">显示排序</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="sort_order" id="sort_order" placeholder="50">
                                        <small></small>
                                    </div>
                                 </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">搜索关键字</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="keywords" id="keywords" placeholder="关键字">
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">搜索描述</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="cat_desc" id="cat_desc" placeholder="描述">
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <a onclick="javascript:history.back(-1);" ><div class="btn btn-default" type="reset" >返回</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                                        <button class="btn btn-info" type="button" onclick="master_add()">提交</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>
{include file='Public:script'}
{include file='Public:validation'}
<script>

    //提交
    function master_add(){
        var param = new Object();
        $("input").each(function(k, v){
            v = $(v);
            param[v.attr("id")] = v.val();
        });
        param['is_open']=$('input[name="show_in_nav"]:checked').val();
        $.post(
            "{:url('add')}",
             param,
             function(ret){
            if(ret.code != 200){
                layer.msg(ret.msg, {icon: 2});
                return false;
            }
            layer.msg(ret.msg, {icon: 1,time:2000},function(){
                location.href = "{:url('category_List')}";
            });
        });
    }
</script>

</html>